{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "不错\n"
     ]
    }
   ],
   "source": [
    "# if语句\n",
    "\n",
    "score = 99\n",
    "if score < 60 :\n",
    "    print('不及格')\n",
    "elif score == 60:\n",
    "    print('刚刚及格')\n",
    "else:\n",
    "    print('不错')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "xrpusd 以美元计价\n"
     ]
    }
   ],
   "source": [
    "# if语句\n",
    "symbol = 'xrpusd'  # 尝试将symbol改成'xrpbtc'，'xrpeth', 'xrpbnb'看相关结果。\n",
    "if symbol.endswith('usd'):\n",
    "    print(symbol, '以美元计价')\n",
    "elif symbol.endswith('btc'):\n",
    "    print(symbol, '以比特币计价')\n",
    "elif symbol.endswith('eth'):\n",
    "    print(symbol, '以以太坊计价')\n",
    "else:\n",
    "    print(symbol, '不知道以什么计价')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bijingrui\n",
      "GDUFE\n",
      "80661059\n"
     ]
    }
   ],
   "source": [
    "# for语句\n",
    "for item in ['bijingrui', 'GDUFE', '80661059']:\n",
    "    print(item)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "注意：\n",
    "\n",
    "range(0,10)\n",
    "\n",
    "代表： [start, stop)\n",
    "\n",
    "0 1 2 3 4 5 6 7 8 9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "55\n"
     ]
    }
   ],
   "source": [
    "# for语句 计算1+2+...+10\n",
    "sum = 0\n",
    "for i in range(1,10 + 1):\n",
    "    sum += i\n",
    "print(sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30\n",
      "60\n",
      "90\n",
      "120\n"
     ]
    }
   ],
   "source": [
    "i = 0\n",
    "while (i < 100):\n",
    "    i += 30\n",
    "    print(i)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
